<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace kitego\extend\login\admin;

class AdminLoginBase implements AdminLoginInterface
{
    public function login($params)
    {}

    /**
     * 生成管理端Token
     */
    public function generateJwtToken($systemAdmin)
    {
        // 角色权限 // 超管、管理员、员工
        $adminRole = ['super', 'admin', 'staff'];

        // 生成adminToken
        $adminToken = setAdminJWT([
            'adminRole' => $adminRole,
            'adminId' => $systemAdmin['id'],
            'adminNickname' => $systemAdmin['nickname'],
            'adminAvatar' => $systemAdmin['avatar']
        ]);

        return success([
            'adminToken' => $adminToken,
            'adminInfo' => [
                'adminRole' => $adminRole,
                'adminId' => $systemAdmin['id'],
                'adminNickname' => $systemAdmin['nickname'],
                'adminAvatar' => $systemAdmin['avatar'],
            ]
        ]);
    }
}